<?php
/**
 * Created by PhpStorm.
 * User: HuangLuSen
 * Date: 2017/5/19
 * Time: 12:00
 */

namespace app\admin\model;


use think\Model;
class Wesmslog extends Model
{
    protected $autoWriteTimestamp = true;
    protected $updateTime = false;
    protected $auto = ['ip'];

    /**
     * 自动完成 填充ip
     * @return mixed
     */
    protected function setIpAttr()
    {

        return request()->ip();
    }
    /**
     * 用户状态修改器
     * @param $value
     * @param $data
     * @return mixed
     */
    public function getLogTypeTextAttr($value, $data)
    {
        $status = [1=>'<span class="label label-primary">微信日志</span>',2=>'<span class="label label-info">短信日志</span>',3=>'<span class="label label-warning">转介绍微信日志</span>'];
        return $status[$data['log_type']];
    }
    /**
     * 用户状态修改器
     * @param $value
     * @param $data
     * @return mixed
     */
    public function getIsSuccessTextAttr($value, $data)
    {
        $status = [1=>'<span class="label label-success">发送成功</span>',2=>'<span class="label label-danger">发送失败</span>'];
        return $status[$data['is_success']];
    }
}